package com.cn.springcloudwechat.mapper.mapper.vaccine;

import java.util.List;
import java.util.Map;

import org.apache.ibatis.annotations.Param;

import com.cn.springcloudwechat.common.mybatis.Page;
import com.cn.springcloudwechat.model.vaccine.YmVaccine;
import org.springframework.stereotype.Repository;

@Repository
public interface YmVaccineMapper {
    int deleteByPrimaryKey(Long vaccineId);

    int insert(YmVaccine record);

    int insertSelective(YmVaccine record);

    YmVaccine selectByPrimaryKey(Long vaccineId);

    int updateByPrimaryKeySelective(YmVaccine record);

    int updateByPrimaryKey(YmVaccine record);
    
    /**
	 * 疫苗周岁的详情查询
	 * 
	 * @param YmVaccine ymVaccine
	 *           
	 * @return List<YmVaccine>
	 */
    List<Object> queryVaccineMapper(@Param("YmVaccine") YmVaccine ymVaccine,Page<Object> page);
    
    /**
	 * 疫苗关联查询(包括详情)
	 * 
	 * @param YmVaccine YmVaccine
	 *           
	 * @return List<YmVaccine>
	 */
    List<YmVaccine> queryVaccineRelevanceDetailMapper(Map<String,Object> map);
    
    /**
	 * 疫苗关联查询(包括详情)*找到某个疫苗所有所有关联疫苗(管理端)
	 * 
	 * @param age
	 *           
	 * @return List<Map<String,Object>>
	 */
    List<YmVaccine> queryVaccineInoculationPlanMapper(Map<String,Object> map);
    
    /**
	 * 递归查询(前)
	 *
	 * @param parentId
	 * 
	 * @return List<YmVaccine>
	 */
    List<YmVaccine> queryVaccineHistoryPlanMapper(@Param("parentId") Long parentId);
    
    
    List<YmVaccine> queryVaccineHistoryPlanAllaMapper(Map<String,Object> map);
    
    
    List<YmVaccine> queryVaccineHistoryPlanAllbMapper(Map<String,Object> map);
    
    /**
   	 * 递归查询(后)
   	 *
   	 * @param parentId
   	 * 
   	 * @return List<YmVaccine>
   	 */
    List<YmVaccine> queryVaccineHistoryPlanAfterMapper(@Param("vaccineId") Long vaccineId);
    
    /**
	 * 查询历史疫苗(移动端)
	 * 
	 * @param 
	 *           
	 * @return List<YmVaccine>
	 */
    List<YmVaccine> queryVaccineHstoryPlanAllMapper(@Param("childId") Long childId);
    
    /**
	 * 验证是否存在该调疫苗数据
	 * 
	 * @param 
	 *           
	 * @return Integer
	 */
    Integer queryIfExist(Map<String,Object> map);
    
    /**
	 * 根据年龄查询参考计划
	 * 
	 * @param String age
	 *           
	 * @return List<YmVaccine>
	 */
    public List<YmVaccine> queryVaccinePlanAgeMapper(@Param("age") String age);
	/**
	 * 用户手动录入接种记录(根据疫苗ID,孩子ID查询所有未接种的剂次)
	 *
	 * @param vaccineTypeId
	 *
	 * @return
	 */
	public List<YmVaccine> queryAgentByVaccineTypeId(@Param("vaccineTypeId") Long vaccineTypeId,@Param("childId") Long childId);


	/**
	 * 获取孩子最大剂次
	 * @param childeId
	 * @param vaccineTypeId
	 * @return
	 */
	int getChildeAgent(@Param("childeId") Long childeId,@Param("vaccineTypeId") Long vaccineTypeId);
	/**
	 * 获取剩余剂次
	 * @param vaccineTypeId
	 * @param agent
	 * @return
	 */
	List<YmVaccine> getVaccineMapperByParameter(@Param("vaccineTypeId") Long vaccineTypeId,@Param("agent") Integer agent);

	/**
	 * 查询预约数据
	 * @param childId
	 * @return
	 */
	List<Map<String,Object>>queryVaccineOrderPlanAllMapper(@Param("childId") Long childId);

}